﻿@using System.Web
@using System.Web.Optimization
@using BlogEngine.Core
@{
    App_Code.WebUtils.CheckRightsForAdminPagesPages(false);
    string loginUrl = Href(Utils.RelativeWebRoot + "Account/login.aspx");
    var id = Request["id"];
    var returnUrl = Request["return"];
    if (string.IsNullOrEmpty(returnUrl)) { returnUrl = Utils.RelativeWebRoot + "admin/#/content"; }
    var userRights = Security.CurrentUserRights().Select(r => r.Flag).ToArray();
}
<html data-ng-app="blogEditor">
<head>
    <title>{{lbl.editor}}</title>
    <link rel="shortcut icon" href="@Href(Utils.ApplicationRelativeWebRoot + "pics/blogengine.ico")" type="image/x-icon" />
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    @Styles.Render("~/Content/css")
    <script type="text/javascript">
        if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
            var msViewportStyle = document.createElement("style");
            var mq = "@@-ms-viewport{width:auto!important}";
            msViewportStyle.appendChild(document.createTextNode(mq));
            document.getElementsByTagName("head")[0].appendChild(msViewportStyle);
        }
    </script>
</head>
<body data-ng-controller="PostEditorController" class="@Resources.labels.LangDirection">
    <script type="text/javascript">
        var SiteVars = {
            ApplicationRelativeWebRoot: '@Utils.ApplicationRelativeWebRoot',
            RelativeWebRoot: '@Utils.RelativeWebRoot',
            BlogInstanceId: '@Blog.CurrentInstance.Id',
            UserName: '@User.Identity.Name',
            UserRights: ['@Html.Raw(string.Join("', '", userRights))'],
            AbsoluteWebRoot: '@Utils.AbsoluteWebRoot',
            Version: 'BlogEngine.NET ' + '@BlogSettings.Instance.Version()'
        };
        var editVars = {
            id: '@id'
        };
    </script>
    <script type="text/javascript" src="admin.res.axd"></script>
    <div id="wrap">
        <form id="form" action="" style="margin:0;">
            @RenderPage("_nav.cshtml")
            <div class="subnav admin-views-subnav">
                <div class="container">
                    <ul class="nav nav-pills">
                        <li class="active"><a href="{{SiteVars.RelativeWebRoot}}admin/#/content">{{lbl.posts}}</a></li>
                        <li><a href="{{SiteVars.RelativeWebRoot}}admin/#/content/comments">{{lbl.comments}}</a></li>
                        <li><a href="{{SiteVars.RelativeWebRoot}}admin/#/content/pages">{{lbl.pages}}</a></li>
                        <li><a href="{{SiteVars.RelativeWebRoot}}admin/#/content/categories">{{lbl.categories}}</a></li>
                        <li><a href="{{SiteVars.RelativeWebRoot}}admin/#/content/tags">{{lbl.tags}}</a></li>
                    </ul>
                </div>
            </div>
            @RenderPage("_postmodals.cshtml")
            @RenderPage("_source.cshtml")
            <div class="container editor admin-editor admin-editor-post">
                <div id="overlay-editor">
                    <div class="row clearfix">
                        <div class="col-md-9">
                            <div class="well-editor">
                                <input type="text" id="txtTitle" name="txtTitle" placeholder="{{lbl.titleOfPost}}..." class="form-control" data-ng-model="post.Title" />
                                @RenderPage("_editor.cshtml")
                            </div>
                        </div>
                        <div class="col-md-3">
                            <button type="button" data-target="#modal-form" data-toggle="modal" class="btn btn-default btn-block" style="margin-bottom:20px;"><i class="fa fa-cog"></i>{{lbl.settings}}</button>
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <i class="fa fa-folder"></i> {{lbl.categories}}
                                </div>
                                <ul class="list-group categories-list">
                                    <li class="list-group-item" ng-repeat="cat in lookups.CategoryList">
                                        <label>
                                            <input type="checkbox" id="cat-{{cat.OptionValue}}" data-ng-model="cat.IsSelected" />
                                            {{cat.OptionName}}
                                        </label>
                                    </li>
                                </ul>
                            </div>
                            <div class="panel panel-default post-tags-selector">
                                <div class="panel-heading">
                                    <i class="fa fa-tag fa-sm"></i>
                                    {{lbl.tags}}
                                </div>
                                <div class="tags-list">
                                    <textarea id="postTags" class="form-control" placeholder="{{lbl.typeAndEnter}}..." rows="1"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <hr />
                    <div class="btn-wrapper clearfix">
                        <div class="pull-left">
                            <button disabled="disabled" class="btn btn-default" style="border:none;">
                                <i class="fa fa-info-circle"></i><span ng-if="!post.IsPublished">{{lbl.unpublished}}</span><span ng-if="post.IsPublished">{{lbl.publishedOn}} {{post.DateCreated}}</span>
                            </button>
                        </div>
                        <div class="pull-right">
                            <span id="spinner" class="loaded"><i class='fa fa-spinner fa-spin fa-lg'></i></span>
                            <a href="@returnUrl" class="btn btn-default"><i class="fa fa-ban"></i>{{lbl.cancel}}</a>

                            <span ng-if="post.Id" class="divider"></span>
                            <span ng-if="post.Id && post.IsPublished"><a href="#" class="btn btn-default" ng-click="publish(false)"><i class="fa fa-undo"></i> {{lbl.unpublish}}</a></span>
                            <span ng-if="status() < 2"><a href="#" ng-click="save()" class="btn btn-default"><i class="fa fa-save"></i> {{lbl.save}}</a></span>
                            <a ng-if="status() < 2" href="#" data-ng-click="publish(true)" class="btn btn-success"><i class="fa fa-check"></i>{{lbl.publish}}</a>
                            <a ng-if="status() == 2" href="#" data-ng-click="save()" class="btn btn-success"><i class="fa fa-save"></i>{{lbl.save}}</a>
                            <span ng-if="post.Id"><a href="{{post.RelativeLink}}" class="btn btn-default" target="_new"><i class="fa fa-eye"></i> {{lbl.goToPost}}</a></span>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div id="footer" data-ng-include src="'../views/shared/_footer.html'"></div>
    @Scripts.Render("~/scripts/wysiwyg")
</body>
</html>
